﻿using DeZhen.DataCollection.IRepository.CollectionTemplate;
using DeZhen.DataCollection.Model.Entities;
using DeZhen.DataCollection.Model.Enums;
using SqlSugar;

namespace DeZhen.DataCollection.Repository.CollectionTemplate
{
    public class CollectionTemplateDetailRepository : BaseRepository<CollectionTemplateDetail>, ICollectionTemplateDetailRepository
    {
        private ISqlSugarClient _db;
        public CollectionTemplateDetailRepository(ISqlSugarClient db) : base(db)
        {
            _db = db;
        }

        public async Task<List<CollectionTemplateDetail>> GetDetailByTemplateIdAsync(long collectionTemplateId)
        {
            return await _db.Queryable<CollectionTemplateDetail>()
                .Where(x => x.CollectionTemplateId == collectionTemplateId)
                .ToListAsync();
        }
    }
}
